package cn.echarts.map.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import cn.echarts.map.service.EchartsMapService;
/**
 * 
 * @ClassName: EchartsMapController
 * @Company: https://www.ali.cn/
 * @Description: 
 * @author sunshine 
 * @date 2018年12月29日 上午9:41:59
 */
@Controller
public class EchartsMapController {
	
	//0.注入业务层对象
	@Resource
	private EchartsMapService echartsMapService;
	/**
	 * 1.根据年份查询陕西省当年各地区的财政收入情况
	 * http://localhost:8080/echartsMap/queryShanXiEveryAreaIncome.action?time=2018
	 * @Title: queryShanXiEveryAreaIncome
	 * @author sunshine
	 * @Description: 
	 * @param response
	 * @param time
	 * @return void
	 * @throws IOException 
	 * @throws 
	 * @date 2018年12月29日 上午9:50:42
	 */
	@RequestMapping("/queryShanXiEveryAreaIncome.action")
	public void queryShanXiEveryAreaIncome(HttpServletResponse response,@RequestParam(defaultValue="2018")String time) throws IOException{
		//处理 编码格式  及 跨域问题
				response.setContentType("text/html; charset=utf-8");
				response.setHeader("Access-Control-Allow-Origin", "*");
				//调用业务层方法
				String jsonData =	echartsMapService.queryShanXiEveryAreaIncome(time);
				//将结果以流的形式输出到请求位置
					PrintWriter out=response.getWriter();
					out.println(jsonData);
					out.flush();
					out.close();
	}
	
	
	
	
}
